#!/usr/bin/env node

const http = require('http'),
       url  = require('url'),
       log  = console.log;
let   addr = 'http://localhost:8080',
      msg = process.argv[2] || 'usr=wangding\n';
          
let opt= url.parse(addr);
opt.method = 'POST';

let req = http.request(opt, (res) => {
  log(`HTTP/${res.httpVersion} ${res.statusCode} ${res.statusMessage}`);
  log(res.headers);
  log('');

  res.pipe(process.stdout);
 });

req.end(msg);

